Imports System.Collections.Generic
Imports System.Text


Public MustInherit Class DbfIndex
	'internal Core.NdxFile mIndexTable;

	Public MustOverride Function GetRecord(p As Int32) As DbfRecord
End Class

Public Class DbfIndex(Of TRecord As {DbfRecord, New})
	Inherits DbfIndex
	Implements IEnumerable(Of TRecord)
	Friend mIndexTable As Core.NdxFile(Of TRecord)

	Friend Sub New()
	End Sub

	#Region "IEnumerable<TRecord> Members"

	Public Function GetEnumerator() As IEnumerator(Of TRecord) Implements IEnumerable(Of TRecord).GetEnumerator
		Return mIndexTable.GetEnumerator()
	End Function

	#End Region

	#Region "IEnumerable Members"

	Private Function System_Collections_IEnumerable_GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
		Return mIndexTable.GetEnumerator()
	End Function

	#End Region

	Public Sub Dump()
		Me.mIndexTable.Dump()
	End Sub

	'public new TRecord GetRecord(Int32 p)
	'{
	'    return mIndexTable.GetRecordByRowIndex(p);
	'}

	Public Overrides Function GetRecord(p As Int32) As DbfRecord
		Return mIndexTable.GetRecordByRowIndex(p)
	End Function


	Public Function Find(Of T1 As IComparable(Of T1))(fieldValue1 As T1) As IEnumerable(Of TRecord)
		Return mIndexTable.Find(Of T1)(fieldValue1)
	End Function
End Class
